<%@ Page Language="vb" AutoEventWireup="false" Codebehind="MUKList.aspx.vb" Inherits="MIMS_WRS.Web.MUKList"%>
<%@ Register TagPrefix="dxwdc" Namespace="DevExpress.Web.ASPxDataControls" Assembly="DevExpress.Web.ASPxDataControls, Version=2.5.1.0, Culture=neutral, PublicKeyToken=79868b8147b5eae4" %>
<%@ Register TagPrefix="dxwg" Namespace="DevExpress.Web.ASPxGrid" Assembly="DevExpress.Web.ASPxGrid2, Version=2.5.1.0, Culture=neutral, PublicKeyToken=79868b8147b5eae4" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title>MUK P.O. and Container Schedule</title>
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<link href="../style.css" type="text/css" rel="stylesheet">
		<script language="javascript" id="clientEventHandlersJS">
<!--

function window_onload() {
	//document.getElementById
	if (document.body.childNodes[0].innerHTML.toString().indexOf("This application was created using the TRIAL version") > -1){
		document.body.childNodes[0].innerHTML = "";
	}
}

var orderType = "<%=OrderType%>";
var currentSorting = "<%=CurrentSorting%>"
var pageURL = "MUKList.aspx";

function changeOrderType() {
	var toOrderType = 1;
	
	if (parseInt(orderType) == 1) {toOrderType = 0}
	
	window.location.href = pageURL + "?type=" + toOrderType + "&sort=" + currentSorting;
	return false;
}

function sortBy(sort) {
	window.location.href = pageURL + "?type=" + orderType + "&sort=" + sort;
/*	var theGrid = ASPxGrid1;
	var orderTypeCol = theGrid.GetColumnByFieldName("PONo_Type");
	var reqCol = theGrid.GetColumnByFieldName("REQ");
	
	ASPxGrid1.BeginUpdate();
	//ASPxGrid1.ClearSorting();
	clearSort();

	orderTypeCol.SetSortingOrder = "Ascending";
	orderTypeCol.SetSortingIndex = 0;

	ASPxGrid1.EndUpdate();*/
	
	return false;
}

function clearSort() {
	var i, j;
	var col;
	
	j = ASPxGrid1.GetColumnCount;
	
	for (i = 0; i < j; i++) {
		col = ASPxGrid1.GetColumn(i);
		col.SetSortingOrder = "None";
		col.SetSortingIndex = -1;
	}
}

function itemRender(obj, args){
	if (args.itemType == "Item" || args.itemType == "AlternatingItem") {
		// Render Shipping Line
		var slElement = ASPxClientUtils.GetChildByTagNameEx(args.htmlElement, "A", 0, true);
		
		if (slElement != null){
			// Check if it is shipping Line or not
			if (slElement.id.toString().indexOf("shippingLine1") > -1) {
				var slValue = args.row.GetDataControllerRow().GetValueByFieldName("ShippingLine");
				if (slValue != null) {
					slElement.innerHTML = slValue;
					slElement.href = "navigate.aspx?sl=" + slValue;
				}
				else {
					slElement.innerHTML = "";
					slElement.href = "";
				}
			}
		}
		
		window.status = args.htmlElement.outerHTML;
		
		// Apply style for newly edited
		//args.htmlElement.className = "gridRowThisWeek";
		
		// Calcuate week number
		var etaDate;
		var weekNumberElement = ASPxClientUtils.GetChildByIdEx(args.htmlElement, "weekNumber", 0, true);
		var wkValue;
		//alert(weekNumberElement);
		if (weekNumberElement != null) {
			etaDate = args.row.GetDataControllerRow().GetValueByFieldName("ETA");
			wkValue = getWeek(etaDate);
			if (wkValue) {
				weekNumberElement.innerText = wkValue.toString().replace(/\b(\d)\b/g, '0$1');
				
			} else {
				weekNumberElement.innerText = "&nbsp;";
			}
		}
		
		args.handled = true;
	}
}


function getWeek(inDate) { 
	var myDate = new Date(inDate);
	var myDay;
	
	if (isNaN(myDate))
		return false;
		
	myDay = myDate.getUTCDay();
	if (myDay == 0) {
		myDay = 7;
	}
	
	myDate.setDate(myDate.getDate() + (3 - myDay));
	
	var yearNumber = myDate.getUTCFullYear();

	var days = Math.floor( (myDate.getTime() - new Date(yearNumber, 0, 1, -6)) / 864e5 );
	var weekNumber = 1 + Math.floor(days/7);
	
	return weekNumber; // + "-" + yearNumber;
}
  
//-->
		</script>
	</head>
	<body language="javascript" onload="return window_onload()">
		<form id="Form1" method="post" runat="server">
			<table style="WIDTH: 100%" cellspacing="0" cellpadding="0" border="0">
				<tr>
					<td class="title" style="HEIGHT: 30px">
						<table style="WIDTH: 100%" cellspacing="0" cellpadding="0" border="0">
							<tr>
								<td class="title" style="HEIGHT: 30px">MUK P.O. and Container Schedule
								</td>
								<td class="txtSmall" align="right"><a href="../Login.aspx?logout=1">Log out</a></td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td style="HEIGHT: 22px">
						<table style="WIDTH: 100%" cellspacing="0" cellpadding="0" border="0">
							<tr>
								<td>
									<table cellspacing="0" cellpadding="0" border="0">
										<tr>
											<td class="txtsmall">Sort by:&nbsp;<a onclick="javascript:return sortBy(0);" href="javascript:void(0);">Requisition 
													No.</a>&nbsp;|&nbsp;<a href="javascript:sortBy(1);">Order Type</a>&nbsp;|&nbsp;<a onclick="javascript:return sortBy(2);" href="javascript:void(0);">Factory 
													ETD</a>&nbsp;|&nbsp;<a onclick="javascript:return sortBy(3);" href="javascript:void(0);">Customer/Final 
													Destination</a>&nbsp;|&nbsp;<a onclick="javascript:return sortBy(4);" href="javascript:void(0);">ETA</a>&nbsp;|&nbsp;<a onclick="javascript:return sortBy(5);" href="javascript:void(0);">PO 
													Number (Locate Last No)</a>&nbsp;&nbsp;&nbsp; Current Sorting:&nbsp;<asp:label id="lblSorting" runat="server" cssclass="txtSmall">Requisition No. - Primary</asp:label>
											</td>
										</tr>
									</table>
								</td>
								<td class="txtSmall" style="TEXT-ALIGN: right"><a onclick="javascript:return changeOrderType();" href="javascript:void(0);"><%=OrderTypeLabel()%></a></td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td style="HEIGHT: 22px">
						<table cellspacing="0" cellpadding="0" border="0">
							<tr>
								<td class="gridItem">Column Indicators:&nbsp;</td>
								<td class="gridColumnAll">All&nbsp;&nbsp;</td>
								<td class="gridColumnOfficer">Office&nbsp;&nbsp;</td>
								<td class="gridColumnSupplier">Factory</td>
								<td class="gridItem">&nbsp;&nbsp;&nbsp;&nbsp;Row Indicators:&nbsp;</td>
								<td class="gridRowThisWeek">Modified this week&nbsp;&nbsp;</td>
								<td class="gridRowLastWeek">Modified last week&nbsp;&nbsp;</td>
								<td class="gridItem">Older items</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td><asp:label id="lblError" runat="server" cssclass="hightlightred" enableviewstate="False"></asp:label></td>
				</tr>
				<tr>
					<td><dxwg:aspxgrid id=ASPxGrid1 tabIndex=0 runat="server" CssClass="grid" Height="600px" ProcessingMode="Server" ReadOnly="True" HeaderHeight="22px" DataMember="ShippingStatusReport" StatusText="Done" PageSize="0" AutoGenerateColumns="False" DataKeyField="ID" DataSource="<%# ShippingStatusReportDS1 %>" PagerPosition="Top" PagerIndent="5px" NavigatorIndent="5px">
							<alternatingitemstyle backcolor="#E2E2E2" cssclass="gridAltItem"></alternatingitemstyle>
							<clientsidemodeoptions postbackonpagesizechanging="True"></clientsidemodeoptions>
							<lookandfeel>
								<editorstyle cssclass="gridItem"></editorstyle>
							</lookandfeel>
							<searchbtnstyle fixedwidth="True"></searchbtnstyle>
							<groupitemstyle fixedwidth="True" wrap="False"></groupitemstyle>
							<buttonbars>
								<dxwg:buttonbar buttonbartype="Pager" verticalindent="5px" verticalposition="Top">
									<baritems>
										<dxwdc:barbutton text="Save" visible="False" buttontype="Refresh" horizontalindent="2px"></dxwdc:barbutton>
										<dxwdc:barbutton buttontype="InsertRow"></dxwdc:barbutton>
										<dxwdc:barbutton buttontype="AppendRow"></dxwdc:barbutton>
										<dxwdc:barbutton buttontype="EditRow"></dxwdc:barbutton>
										<dxwdc:barbutton buttontype="DeleteRow"></dxwdc:barbutton>
										<dxwdc:bareditmodebutton buttontype="Post"></dxwdc:bareditmodebutton>
										<dxwdc:bareditmodebutton buttontype="Cancel"></dxwdc:bareditmodebutton>
										<dxwdc:barbutton text="Add new" tooltip="add new record" name="AddNew" width="60px"></dxwdc:barbutton>
										<dxwdc:barbutton text="Delete" tooltip="delete selected records" name="Delete" width="60px"></dxwdc:barbutton>
										<dxwdc:barbutton tooltip="Download selected records to Excel" name="DownloadExcel" imageurl="../Images/b_grid_excel.gif"></dxwdc:barbutton>
										<dxwdc:barbutton tooltip="Mark selected records as completed" name="MarkCompleted" imageurl="../Images/b_grid_flag.gif"></dxwdc:barbutton>
									</baritems>
								</dxwg:buttonbar>
								<dxwg:buttonbar buttonbartype="Navigator" verticalindent="5px">
									<baritems>
										<dxwdc:barbutton text="Save" visible="False" buttontype="Refresh" horizontalindent="2px"></dxwdc:barbutton>
										<dxwdc:barbutton buttontype="InsertRow"></dxwdc:barbutton>
										<dxwdc:barbutton buttontype="AppendRow"></dxwdc:barbutton>
										<dxwdc:barbutton buttontype="EditRow"></dxwdc:barbutton>
										<dxwdc:barbutton buttontype="DeleteRow"></dxwdc:barbutton>
										<dxwdc:bareditmodebutton buttontype="Post"></dxwdc:bareditmodebutton>
										<dxwdc:bareditmodebutton buttontype="Cancel"></dxwdc:bareditmodebutton>
										<dxwdc:barbutton text="Add new" tooltip="add new record" name="AddNew" width="60px"></dxwdc:barbutton>
										<dxwdc:barbutton text="Delete" tooltip="delete selected records" name="Delete" width="60px"></dxwdc:barbutton>
										<dxwdc:barbutton tooltip="Download selected records to Excel" name="DownloadExcel" imageurl="../Images/b_grid_excel.gif"></dxwdc:barbutton>
										<dxwdc:barbutton tooltip="Mark selected records as completed" name="MarkCompleted" imageurl="../Images/b_grid_flag.gif"></dxwdc:barbutton>
									</baritems>
								</dxwg:buttonbar>
							</buttonbars>
							<headerstyle fixedwidth="True" fixedheight="True" wrap="False" cssclass="gridHeader"></headerstyle>
							<images imgbbrefresh="../Images/b_grid_save.gif"></images>
							<statusbars>
								<dxwg:statusbar height="20px" statusbartype="Regular">
									<baritems>
										<dxwdc:barstatussection statussectiontype="Status"></dxwdc:barstatussection>
										<dxwdc:barstatussection statussectiontype="VisibleInterval"></dxwdc:barstatussection>
										<dxwdc:barstatussection statussectiontype="TotalVisible"></dxwdc:barstatussection>
										<dxwdc:barstatussection statussectiontype="TotalRows"></dxwdc:barstatussection>
									</baritems>
								</dxwg:statusbar>
							</statusbars>
							<itemstyle fixedwidth="True" cssclass="gridItem" wrap="False"></itemstyle>
							<pagerbuttons moveprevpage="False" movenextpage="False" gotopage="False" pageindexes="False"></pagerbuttons>
							<barbtnstyle cssclass="txtSmall"></barbtnstyle>
							<buttontooltips tooltiprefresh="Save changes"></buttontooltips>
							<footerstyle fixedwidth="True" fixedheight="True" cssclass="gridFooter"></footerstyle>
							<edititemstyle cssclass="gridItem"></edititemstyle>
							<appearanceoptions showfooter="True" showgrouppanel="False" showpager="True"></appearanceoptions>
							<behavioroptions enablecolumnmoving="False" enableheaderclick="False" keepwidth="True" enablemultiselection="True"
								confirmunsavedchanges="True" enableheaderdragging="False" keepediting="True" enablegrouping="False"
								enablefocusedrowclick="False" enablerowdblclick="False" casesensitivesorting="False"></behavioroptions>
							<columns>
								<dxwg:boundcolumn headertext="Req" dataformatstring="{0:D4}" visibleindex="0" datafield="REQ" sortingindex="0"
									width="42px" editortype="TextBox" sortingorder="Ascending" footertext="Req">
									<footerstyle cssclass="gridColumnAll"></footerstyle>
									<itemstyle horizontalalign="Center"></itemstyle>
									<headerstyle horizontalalign="Center" cssclass="gridColumnAll"></headerstyle>
									<editorproperties maxlength="4" dataformatstring="{0:D4}"></editorproperties>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="Order Date" dataformatstring="{0:dd/MMM/yy}" visibleindex="1" datafield="OrderDate"
									editformatstring="dd/MM/yy" width="70px" editortype="DateEdit" footertext="Order Date">
									<footerstyle cssclass="gridColumnOfficer"></footerstyle>
									<itemstyle horizontalalign="Center"></itemstyle>
									<headerstyle cssclass="gridColumnOfficer"></headerstyle>
									<editorproperties dataformatstring="{0:dd/MMM/yy}" editformatstring="dd/MM/yy"></editorproperties>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="Bulk" visibleindex="2" datafield="BulkType" width="36px" editortype="DropDownList"
									footertext="Bulk">
									<footerstyle cssclass="gridColumnAll"></footerstyle>
									<headerstyle cssclass="gridColumnAll"></headerstyle>
									<editorproperties>
										<items>
											<dxwdc:editorlistitem text="New" value="System.String:N"></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="Full" value="System.String:F"></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="Part" value="System.String:P"></dxwdc:editorlistitem>
										</items>
									</editorproperties>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="BK.O/No" dataformatstring="{0:D6}" visibleindex="3" datafield="BulkOrderNo"
									width="48px" footertext="BK.O/No">
									<footerstyle cssclass="gridColumnAll"></footerstyle>
									<itemstyle horizontalalign="Center"></itemstyle>
									<headerstyle cssclass="gridColumnAll"></headerstyle>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="Size" visibleindex="4" datafield="ContainerSize" width="40px" editortype="DropDownList"
									footertext="Size">
									<footerstyle cssclass="gridColumnOfficer"></footerstyle>
									<itemstyle horizontalalign="Left"></itemstyle>
									<headerstyle cssclass="gridColumnOfficer"></headerstyle>
									<editorproperties>
										<items>
											<dxwdc:editorlistitem></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="40'" value="System.String:40'"></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="40'HC" value="System.String:40'HC"></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="20'" value="System.String:20'"></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="LCL" value="System.String:LCL"></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="Truck" value="System.String:Truck"></dxwdc:editorlistitem>
										</items>
									</editorproperties>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="Pack" visibleindex="5" datafield="LP" width="50px" editortype="DropDownList"
									footertext="Pack">
									<footerstyle cssclass="gridColumnOfficer"></footerstyle>
									<headerstyle cssclass="gridColumnOfficer"></headerstyle>
									<editorproperties shownotexistingvalueitem="True">
										<items>
											<dxwdc:editorlistitem text="H Pallet" value="System.String:H"></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="T Pallet" value="System.String:T"></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="Loose" value="System.String:L"></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="Mixed" value="System.String:M"></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="Samples" value="System.String:S"></dxwdc:editorlistitem>
										</items>
									</editorproperties>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="Type" visibleindex="6" datafield="PONo_Type" width="50px" editortype="DropDownList"
									footertext="Type">
									<footerstyle cssclass="gridColumnAll"></footerstyle>
									<headerstyle cssclass="gridColumnAll"></headerstyle>
									<editorproperties>
										<items>
											<dxwdc:editorlistitem></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="Warehouse" value="System.String:W"></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="Direct" value="System.String:D"></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="Bulk" value="System.String:B"></dxwdc:editorlistitem>
										</items>
									</editorproperties>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="Supp" dataformatstring="{0:D3}" visibleindex="7" datafield="PONo_Supplier"
									width="48px" editortype="TextBox" footertext="Supp">
									<footerstyle cssclass="gridColumnAll"></footerstyle>
									<itemstyle horizontalalign="Center"></itemstyle>
									<headerstyle cssclass="gridColumnAll"></headerstyle>
									<editorproperties maxlength="3" dataformatstring="{0:D3}"></editorproperties>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="O/No" dataformatstring="{0:D3}" visibleindex="8" datafield="PONo_Number"
									width="48px" editortype="TextBox" footertext="O/No">
									<footerstyle cssclass="gridColumnAll"></footerstyle>
									<itemstyle horizontalalign="Center"></itemstyle>
									<headerstyle cssclass="gridColumnAll"></headerstyle>
									<editorproperties maxlength="3" dataformatstring="{0:D3}"></editorproperties>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="Prim" visibleindex="9" datafield="IsPrimary" sortingindex="1" width="46px"
									editortype="DropDownList" sortingorder="Ascending" footertext="Prim">
									<footerstyle cssclass="gridColumnAll"></footerstyle>
									<headerstyle cssclass="gridColumnAll"></headerstyle>
									<editorproperties>
										<items>
											<dxwdc:editorlistitem></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="Primary" value="System.String:P"></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="Secondary" value="System.String:S"></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="Combined" value="System.String:Z"></dxwdc:editorlistitem>
										</items>
									</editorproperties>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="Con" visibleindex="10" datafield="PONo_Consolidation" width="30px" editortype="TextBox"
									footertext="Con">
									<footerstyle cssclass="gridColumnAll"></footerstyle>
									<itemstyle horizontalalign="Center"></itemstyle>
									<headerstyle cssclass="gridColumnAll"></headerstyle>
									<editorproperties maxlength="1"></editorproperties>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="PO In Opera" dataformatstring="{0:dd/MMM/yy}" visibleindex="11" datafield="POInOpera"
									width="86px" footertext="PO In Opera">
									<footerstyle cssclass="gridColumnAll"></footerstyle>
									<headerstyle cssclass="gridColumnAll"></headerstyle>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="Acc No" visibleindex="12" datafield="AccNo" width="60px" editortype="TextBox"
									footertext="Acc No">
									<footerstyle cssclass="gridColumnOfficer"></footerstyle>
									<headerstyle cssclass="gridColumnOfficer"></headerstyle>
									<editorproperties maxlength="6"></editorproperties>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="Customer" visibleindex="13" datafield="CustomerOrLocation" width="150px"
									editortype="TextBox" footertext="Customer">
									<footerstyle cssclass="gridColumnOfficer"></footerstyle>
									<headerstyle cssclass="gridColumnOfficer"></headerstyle>
									<editorproperties maxlength="30"></editorproperties>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="Final Destination" visibleindex="14" datafield="FinalDestination" width="150px"
									editortype="TextBox" footertext="Final Destination">
									<footerstyle cssclass="gridColumnOfficer"></footerstyle>
									<headerstyle cssclass="gridColumnOfficer"></headerstyle>
									<editorproperties maxlength="30"></editorproperties>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="Arrival Port" visibleindex="15" datafield="ArrivalPort" width="150px"
									editortype="TextBox" footertext="Arrival Port">
									<footerstyle cssclass="gridColumnOfficer"></footerstyle>
									<headerstyle cssclass="gridColumnOfficer"></headerstyle>
									<editorproperties maxlength="30"></editorproperties>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="Description" visibleindex="16" datafield="Description" width="300px"
									editortype="TextBox" footertext="Description">
									<footerstyle cssclass="gridColumnAll"></footerstyle>
									<headerstyle cssclass="gridColumnAll"></headerstyle>
									<editorproperties maxlength="50"></editorproperties>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="Factory ETD" dataformatstring="{0:dd/MMM/yy}" visibleindex="17" datafield="FactoryETD"
									editformatstring="dd/MM/yy" width="84px" editortype="DateEdit" footertext="Factory ETD">
									<footerstyle cssclass="gridColumnSupplier"></footerstyle>
									<itemstyle horizontalalign="Center"></itemstyle>
									<headerstyle cssclass="gridColumnSupplier"></headerstyle>
									<editorproperties dataformatstring="{0:dd/MMM/yy}" editformatstring="dd/MM/yy"></editorproperties>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="Shipped Date" dataformatstring="{0:dd/MMM/yy}" visibleindex="18" datafield="ShippingDate"
									editformatstring="dd/MM/yy" width="86px" editortype="DateEdit" footertext="Shipped Date">
									<footerstyle cssclass="gridColumnSupplier"></footerstyle>
									<itemstyle horizontalalign="Center"></itemstyle>
									<headerstyle cssclass="gridColumnSupplier"></headerstyle>
									<editorproperties dataformatstring="{0:dd/MMM/yy}" editformatstring="dd/MM/yy"></editorproperties>
								</dxwg:boundcolumn>
								<dxwg:boundtemplatecolumn headertext="Shipping Line" visibleindex="19" width="80px" editortype="DropDownList"
									footertext="Shipping Line" datafield="ShippingLine">
									<footerstyle cssclass="gridColumnSupplier"></footerstyle>
									<itemtemplate>
										<asp:literal id="ltrSL" runat="server"></asp:literal>
									</itemtemplate>
									<headerstyle cssclass="gridColumnSupplier"></headerstyle>
									<editorproperties>
										<items>
											<dxwdc:editorlistitem></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="K&amp;N" value="System.String:KN"></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="NYK" value="System.String:NYK"></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="Primecargo" value="System.String:Primecargo"></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="Maersk" value="System.String:Maersk"></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="MacAndrews" value="System.String:MacAndrews"></dxwdc:editorlistitem>
										</items>
									</editorproperties>
								</dxwg:boundtemplatecolumn>
								<dxwg:boundcolumn headertext="Vessel" visibleindex="20" datafield="Vessel" width="150px" editortype="TextBox"
									footertext="Vessel">
									<footerstyle cssclass="gridColumnSupplier"></footerstyle>
									<headerstyle cssclass="gridColumnSupplier"></headerstyle>
									<editorproperties maxlength="30"></editorproperties>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="Container No" visibleindex="21" datafield="ContainerNo" editortype="TextBox"
									footertext="Container No">
									<footerstyle cssclass="gridColumnSupplier"></footerstyle>
									<headerstyle cssclass="gridColumnSupplier"></headerstyle>
									<editorproperties maxlength="16"></editorproperties>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="ETA" dataformatstring="{0:dd/MMM/yy}" visibleindex="22" datafield="ETA"
									editformatstring="dd/MM/yy" width="74px" editortype="DateEdit" footertext="ETA">
									<footerstyle cssclass="gridColumnSupplier"></footerstyle>
									<itemstyle horizontalalign="Center"></itemstyle>
									<headerstyle cssclass="gridColumnSupplier"></headerstyle>
									<editorproperties dataformatstring="{0:dd/MMM/yy}" editformatstring="dd/MM/yy"></editorproperties>
								</dxwg:boundcolumn>
								<dxwg:templatecolumn headertext="Wk" visibleindex="23" width="22px" footertext="Wk">
									<itemtemplate>
										<asp:literal id="ltrWeekNo" runat="server"></asp:literal>
									</itemtemplate>
									<itemstyle horizontalalign="Center"></itemstyle>
								</dxwg:templatecolumn>
								<dxwg:boundcolumn headertext="Cont Del" dataformatstring="{0:dd/MMM/yy}" visibleindex="24" datafield="ContainerDeliveried"
									width="70px" footertext="Cont Del">
									<footerstyle cssclass="gridColumnSupplier"></footerstyle>
									<itemstyle horizontalalign="Center"></itemstyle>
									<headerstyle cssclass="gridColumnSupplier"></headerstyle>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="PI/SC" visibleindex="25" datafield="PI" width="60px" editortype="TextBox"
									footertext="PI/SC">
									<footerstyle cssclass="gridColumnOfficer"></footerstyle>
									<headerstyle cssclass="gridColumnOfficer"></headerstyle>
									<editorproperties maxlength="12"></editorproperties>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="Pay Auth" visibleindex="26" datafield="PayAuth" width="50px" footertext="Pay Auth">
									<footerstyle cssclass="gridColumnOfficer"></footerstyle>
									<itemstyle horizontalalign="Center"></itemstyle>
									<headerstyle cssclass="gridColumnOfficer"></headerstyle>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="Payment" visibleindex="27" datafield="Payment" width="60px" editortype="DropDownList"
									footertext="Payment">
									<footerstyle cssclass="gridColumnOfficer"></footerstyle>
									<headerstyle cssclass="gridColumnOfficer"></headerstyle>
									<editorproperties>
										<items>
											<dxwdc:editorlistitem text="Deposit Paid" value="System.String:D"></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="Full Paid" value="System.String:F"></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="L/C Raised" value="System.String:R"></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="L/C Paid" value="System.String:P"></dxwdc:editorlistitem>
											<dxwdc:editorlistitem text="Credit" value="System.String:C"></dxwdc:editorlistitem>
										</items>
									</editorproperties>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="Inv Value" dataformatstring="{0:########.00}" visibleindex="28" datafield="InvValue"
									width="80px" footertext="Inv Value">
									<footerstyle cssclass="gridColumnOfficer"></footerstyle>
									<itemstyle horizontalalign="Right"></itemstyle>
									<headerstyle cssclass="gridColumnOfficer"></headerstyle>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="Pay Date" dataformatstring="{0:dd/MMM/yy}" visibleindex="29" datafield="PayDate"
									width="86px" footertext="Pay Date">
									<footerstyle cssclass="gridColumnOfficer"></footerstyle>
									<headerstyle cssclass="gridColumnOfficer"></headerstyle>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="Doc Received" visibleindex="30" datafield="DocReceived" width="50px"
									footertext="Doc Received">
									<footerstyle cssclass="gridColumnOfficer"></footerstyle>
									<headerstyle cssclass="gridColumnOfficer"></headerstyle>
								</dxwg:boundcolumn>
								<dxwg:boundcolumn headertext="Completed" dataformatstring="{0:dd/MMM/yy}" visibleindex="31" datafield="CompletedDate"
									editformatstring="dd/MM/yy" width="70px" editortype="DateEdit" footertext="Completed">
									<footerstyle cssclass="gridColumnOfficer"></footerstyle>
									<itemstyle horizontalalign="Center"></itemstyle>
									<headerstyle cssclass="gridColumnOfficer"></headerstyle>
									<editorproperties dataformatstring="{0:dd/MMM/yy}" editformatstring="dd/MM/yy"></editorproperties>
								</dxwg:boundcolumn>
							</columns>
							<navigatorbuttons moveprevpage="False" moveprev="False" movefirst="False" movenext="False" movenextpage="False"
								changepagesize="False" movelast="False" appendrow="True"></navigatorbuttons>
							<clientsideevents>
								<customrenderheader>
function(source,e){
	
}
</customrenderheader>
								<barbuttonclick>
function(source,e){
	alert('test')
	if (e.barButton.GetName() == "DownloadExcel") {
		var dataController = ASPxGrid1.GetDataController();
		
		strIds = "";
		
		if (dataController.GetConfirmUnsavedChanges()) {
			alert("Please save changes before downloading to Excel!");
		}
		else {
			var rowCount = ASPxGrid1.GetSelectedRowCount();
			var i;
			var row;
			var itemId;
			var strIds;

			for (i = 0; i < rowCount; i++) {
				row = ASPxGrid1.GetSelectedRow(i);
				itemId = row.GetDataControllerRow().GetValueByFieldName("ID");
				
				strIds += itemId + ",";
			}
			
			if (strIds > ""){
				strIds = "../Excel/MUKPOContainerScheduleExcel.aspx?ids=" + strIds;
				window.open(strIds, "_blank", "menubar=0;location=0;toolbar=0;resizable=1;");
			} 
			
			e.handled = true; 
		}
	}else if (e.barButton.GetName() == "MarkCompleted"){ 
		//alert("Mark Completed button clicked"); 
		e.processOnServer =true;
	}
}
</barbuttonclick>
								<itemrendered>
itemRender
</itemrendered>
							</clientsideevents>
							<footeritemstyle cssclass="gridFooter"></footeritemstyle>
							<statusbarstyle cssclass="gridItem"></statusbarstyle>
						</dxwg:aspxgrid></td>
				</tr>
			</table>
		</form>
		<script language="javascript">
<!--
function openDialog(id) {
	var url = escape('../Offices/MUKDetail.aspx?id=' + id);			
	var title = escape('Order Detail');
	result = window.showModalDialog('../Dialogs/ShowDialog.aspx?title=' + title + '&src=' + url, '', 'dialogHeight: 630px; dialogWidth: 650px; center: yes; resizable: no; scroll: no; status: no;')
	if (result != null) 
	{
		var btnRefresh = window.document.getElementById('<%= btnRefresh.ClientID %>');
		btnRefresh.click();
	}
}

function OnTRDblCl(evt){
	evt = _getEvent(evt);
	var td = _getEventSource(evt);
	var tr = _getParentNode(td);
	while(td != null && tr != null && _strIndexOf(tr.id, idDlmtr) == -1){
		td = tr;
		tr = _getParentNode(td);
	}
	if(td != null && tr != null){
		var _indexOf = tr.id.indexOf(getPreviewRowMark());	
		if(_indexOf == -1){
			_indexOf = tr.id.indexOf(idDlmtr);
			if(_indexOf != -1){
				var gridName = tr.id.substr(0, _indexOf);		
				var gridObj = GetGridCollection().Get(gridName);		
				if(gridObj != null){
					var rowId = getElementRowId(tr);
					var id = rowId.split('~')[1];	
					openDialog(id);					
				}
			}
		}
	}
}

function checkSelected() {
	var gridObj = GetGridCollection().Get('ASPxGrid1');			
	var selectedRows = _getHiddenInput(gridObj.name + "SelectedRows").value;
	if (selectedRows.length > 0)
		return true;
	else {
		alert('Please select items to process');
		return false;
	}
}

function OnDNBtnCl(e, name, index, action){
	
	if (action == 'Custom' && (name=='ASPxGrid1ButtonBar0' || name=='ASPxGrid1ButtonBar1') && index==7) {		
		openDialog(0);
	}
	else 		
	{
		if (action == 'Custom' && (name=='ASPxGrid1ButtonBar0' || name=='ASPxGrid1ButtonBar1') && index==8) 
		{
			if (confirm('Are you sure you want to delete?') == false)
			{
				return;			
			}
		}	
		
		// download excel
		if (action == 'Custom' && (name=='ASPxGrid1ButtonBar0' || name=='ASPxGrid1ButtonBar1') && index==9) 
		{
			if (checkSelected()) {
				var gridObj = GetGridCollection().Get('ASPxGrid1');						
				var selectedRows = _getHiddenInput(gridObj.name + "SelectedRows").value;						
				var rowIds = selectedRows.split(';');
				var recordId;
				var strIds='';
				
				for (i=0; i<rowIds.length; i++)	{
					recordId = rowIds[i].split('~')[3];
					strIds += recordId + ',';
				}			
				
				if (strIds.length > 0){
					strIds = "../Excel/MUKPOContainerScheduleExcel.aspx?ids=" + strIds;
					window.open(strIds, "_blank", "menubar=0;location=0;toolbar=0;resizable=1;");
				} 	
			}			
						
			return;
		}
		
		var dataNavigator = GetDataNavigatorCollection().Get(name);
		if(dataNavigator != null) dataNavigator.BtnClick(e, index, action);	
	}	
}
//-->
		</script>
		<input id="btnRefresh" style="DISPLAY: none" type="button" runat="server">
	</body>
</html>
